#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int minP[N];
int phi[N];
vector<int> p;
const int MOD = 998244353;
int qpow(int x,int p){
	int res = 1;
	while(p){
		if(p & 1){
			res = 1ll*res*x%MOD;
		}
		x = 1ll*x*x%MOD;
		p >>= 1;
	}
	return res;
}
int n,m,k;
int jc[N];
int jc_1[N];
int C(int n,int m){
	if(m < 0){
		return 0;
	}
	return 1ll*jc[n]*jc_1[n - m]%MOD*jc_1[m]%MOD;
}
int solve1(int cnt,int len){
	if(len == cnt){
		return 1;
	}
	int ans = 0;
	for(int j = 0;j <= min(len - cnt - 1,(cnt - 1)/(k - 1));j++){
		if(j % 2 == 0){
			ans = (ans + 1ll*C(cnt - j*(k - 1) - 1,j)*C(cnt - j*(k - 1) - 1 - j + len - cnt - 1,cnt - j*(k - 1) - 1)%MOD)%MOD;
			ans = (ans + 1ll*C(cnt - j*(k - 1) - 1,j - 1)*C(cnt - j*(k - 1) - j + len - cnt - 1,cnt - j*(k - 1) - 2)%MOD)%MOD;
		}else{
			ans = (ans + MOD - 1ll*C(cnt - j*(k - 1) - 1,j)*C(cnt - j*(k - 1) - 1 - j + len - cnt - 1,cnt - j*(k - 1) - 1)%MOD)%MOD;
			ans = (ans + MOD - 1ll*C(cnt - j*(k - 1) - 1,j - 1)*C(cnt - j*(k - 1) - j + len - cnt - 1,cnt - j*(k - 1) - 2)%MOD)%MOD;
		}
	}
	return ans;
}
int solve(int cnt,int len){
	int ans = 0;
	for(int i = 0;i <= min(cnt,k);i++){
		ans = (ans + 1ll*(i + 1)*solve1(cnt - i,len - i)%MOD)%MOD;
	}
	return ans;
}
int main(){
	cin>>n>>m>>k;
	phi[1] = 1;
	for(int i = 2;i<=n;i++){
		if(!minP[i]){
			minP[i] = i;
			phi[i] = i - 1;
			p.push_back(i);
		}
		for(int j = 0;p[j] != minP[i] && 1ll*p[j] * i <= n;j++){
			minP[p[j] * i] = p[j];
			phi[p[j] * i] = (p[j] - 1)*phi[i];
		}
		if(1ll*minP[i]*i <= n){
			minP[i * minP[i]] = minP[i];
			phi[minP[i] * i] = minP[i] * phi[i];
		}
	}
	jc[0]=1;
	for(int i = 1;i<=n;i++){
		jc[i] = 1ll*jc[i - 1]*i%MOD;
	}
	jc_1[n] = qpow(jc[n],MOD - 2);
	for(int i = n - 1;i >= 1;i--){
		jc_1[i] = 1ll*jc_1[i + 1]*(i + 1)%MOD;
	}
	jc_1[0] = 1;
	int ans = 0;
	for(int i = 1;1ll*i*i <= n;i++){
		if(n % i == 0){
			if(m % (n/i) == 0){
				ans = (ans + 1ll*phi[n/i]*solve(m/((n/i)),i)%MOD)%MOD;
			}
			if(n / i != i){
				if(m % i == 0){
					ans = (ans + 1ll*phi[i]*solve(m/i,n/i)%MOD)%MOD;
				}
			}
		}
	}
	ans = 1ll*ans*qpow(n,MOD - 2)%MOD;
	cout<<ans<<'\n';
}
/*
*/